<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="../org/angular.min.js"></script>
    <script src="../org/jquery.min.js"></script>
</head>
<body>
<div ng-app="hd" ng-controller="ctrl">
    <table border="1" width="600">
        <tr>
            <td>网站名称</td>
            <td>网址</td>
        </tr>
        <tr ng-repeat="v in data">
            <td>{{v.name}}</td>
            <td>{{v.url}}</td>
        </tr>
    </table>
</div>
<script>
    //    function a(){
    //        this.name='后盾人';
    //    }
    //    var obj = new a();
    //    console.log(obj.name);
//    function callback($http) {
//        this.get = function () {
//            return $http({method: 'get', url: '1.php'}).then(function (response) {
//                return response.data;
//            })
//        }
//    }

    //$.ajax  $.get $.post
    var m = angular.module('hd', []);
    m.service('videoServer', ['$http', function($http){
        this.get=function(){
            return $http({method:'get',url:'1.php'}).then(function(response){
                return response.data;
            })
        }
    }])
    m.controller('ctrl', ['$scope', 'videoServer', function ($scope, videoServer) {
        videoServer.get().then(function (data) {
            $scope.data = data;
        });
    }]);
</script>
</body>
</html>